﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using DocumentManagement.ViewsModels;
using DocumentManagement.Models;

namespace DocumentManagement.Views
{
    /// <summary>
    /// Interaction logic for PrintPreviewDocumentIn.xaml
    /// </summary>
    public partial class PrintPreviewDocumentIn : Window
    {
        PrintPreviewDocumentInViewsModel _printPreviewDocumentInViewsModel;
        public PrintPreviewDocumentIn(CreateSend printCreateSend, QSHCEntities1 entity)
        {
            InitializeComponent();
            _printPreviewDocumentInViewsModel = this.Resources["printPreviewDocumentInViewsModel"] as PrintPreviewDocumentInViewsModel;
            _printPreviewDocumentInViewsModel.MyPrintCreateSend = printCreateSend;
            _printPreviewDocumentInViewsModel.EntityModels = entity;

        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            
            _printPreviewDocumentInViewsModel.LoadData();
        }

        private void PrintButton_Click(object sender, RoutedEventArgs e)
        {
        
            PrintDialog dialog = new PrintDialog();

            if (dialog.ShowDialog() != true) return;

            grid2.Measure(new Size(dialog.PrintableAreaWidth, dialog.PrintableAreaHeight));
            //grid2.Arrange(new Rect(new Point(50, 50), grid2.DesiredSize));

            dialog.PrintVisual(grid2, "A WPF printing");
        }
    }
}
